package com.ict.ms.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ict.ms.common.StateMsg;
import com.ict.ms.port.facade.api.IPortService;

import javax.annotation.Resource;

/**
 * Created by StevenH on 2016/12/8.
 */
@Controller
@RequestMapping("/port")
public class PortController {
    @Resource
    IPortService service;

    @ResponseBody
    @RequestMapping(value = "getlist.do",method = RequestMethod.GET)
    public String getList(ModelMap map){
        map.addAttribute("portlist",service.portList());
        return StateMsg.toJson(1,map);
    }

    @ResponseBody
    @RequestMapping(value = "getinfo.do",method = RequestMethod.POST)
    public String getList(ModelMap map,@RequestParam(value = "id") int id){
        map.addAttribute("port",service.portInfo(id));
        return StateMsg.toJson(1,map);
    }
}
